#define MAXSIZE 100
typedef double SElemType;

typedef  struct StackNode{
    SElemType  data;
    StackNode *next;
}StackNode, *LinkStack;

void InitStack(LinkStack &S)
{
	  S=NULL;
}

bool StackEmpty(LinkStack S){  
	if (S==NULL) return true;  
	else 
		return false;
}

bool Push(LinkStack &S , SElemType e){
	LinkStack p=new StackNode;       
	if (!p) 
		exit(OVERFLOW); 
	p->data=e; 
	p->next=S; 
	S=p; 
    return true; 
}

bool Pop (LinkStack &S,SElemType &e)
{
	LinkStack p=S;
	if (S==NULL) 
		return false;
	e=S->data; 
	p=S;  
	S=S->next;
    delete p;   
    return true; 
}  

SElemType GetTop(LinkStack S)
   {
       if (S==NULL) exit(1);  
	   else 
		   return S->data;
    }